﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace JXC.EFCore.Migrations
{
    public partial class _123 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Cinfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WarehouseName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    MoneyKind = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    InventoryValue = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Cinfo", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Employee",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EmployeeName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Employee", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsType",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TypeName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsType", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MenuInfos",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ParentId = table.Column<int>(type: "int", nullable: false),
                    ParentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    MUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsTop = table.Column<int>(type: "int", nullable: false),
                    MOrder = table.Column<int>(type: "int", nullable: false),
                    MenuState = table.Column<int>(type: "int", nullable: false),
                    Creator = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MenuInfos", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "RoleInfos",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    RoleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RoleState = table.Column<int>(type: "int", nullable: false),
                    Creator = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoleInfos", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Supplier",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SupplierName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Contactman = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Position = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Address = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    City = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Postcode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Coutry = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Tel = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DepositBank = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BankAccount = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TaxNum = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Website = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UseState = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Supplier", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TheCustomerTable",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ClientName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CustomerAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Phone = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TheCustomerTable", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "UserInfos",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UserPwd = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UserState = table.Column<int>(type: "int", nullable: false),
                    Creator = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    IsDeleted = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserInfos", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CommodityInformationSheet",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ProductName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    GoodsTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Model = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Units = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CinfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UnitPriceOfWarehousingPlan = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    UnitPriceOfDeliveryPlan = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    TheOriginalInventory = table.Column<float>(type: "real", nullable: false),
                    AlertMinimumStock = table.Column<float>(type: "real", nullable: false),
                    AlertMaximumStock = table.Column<float>(type: "real", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CommodityInformationSheet", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CommodityInformationSheet_Cinfo_CinfoId",
                        column: x => x.CinfoId,
                        principalTable: "Cinfo",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NventoryFile",
                columns: table => new
                {
                    Commodity = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Warehouse = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    QuantityInStock = table.Column<int>(type: "int", nullable: false),
                    CinfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NventoryFile", x => x.Commodity);
                    table.ForeignKey(
                        name: "FK_NventoryFile_Cinfo_CinfoId",
                        column: x => x.CinfoId,
                        principalTable: "Cinfo",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "RoleMenuInfos",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleId = table.Column<int>(type: "int", nullable: false),
                    MId = table.Column<int>(type: "int", nullable: false),
                    Creator = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    RoleInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    MenuInfosId = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoleMenuInfos", x => x.Id);
                    table.ForeignKey(
                        name: "FK_RoleMenuInfos_MenuInfos_MenuInfosId",
                        column: x => x.MenuInfosId,
                        principalTable: "MenuInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_RoleMenuInfos_RoleInfos_RoleInfosId",
                        column: x => x.RoleInfosId,
                        principalTable: "RoleInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "Alarm",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Alarmt = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Alarm", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Alarm_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AuditLogging",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WenJianId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Idea = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Reorder = table.Column<int>(type: "int", nullable: false),
                    AuditStatus = table.Column<int>(type: "int", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AuditLogging", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AuditLogging_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "CaigouDuepay",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PayTime = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    HappenDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    SupplierId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Monerary = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DueMoney = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    PaidMoney = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    RemainMoney = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    OperarorID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ExaminerIID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Others = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Chargeoff = table.Column<int>(type: "int", nullable: false),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CaigouDuepay", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CaigouDuepay_Supplier_SupplierId",
                        column: x => x.SupplierId,
                        principalTable: "Supplier",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_CaigouDuepay_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "CaigouEnter",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Monetary = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BuyDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    BuyerID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CaiGouOrderID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OperatorID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EnterDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    OpmanlID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Opdate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ExaminerID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ExamineDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Others = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ExamineState = table.Column<int>(type: "int", nullable: false),
                    SupplierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CaigouEnter", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CaigouEnter_Supplier_SupplierId",
                        column: x => x.SupplierId,
                        principalTable: "Supplier",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_CaigouEnter_UserInfos_BuyerID",
                        column: x => x.BuyerID,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_CaigouEnter_UserInfos_ExaminerID",
                        column: x => x.ExaminerID,
                        principalTable: "UserInfos",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_CaigouEnter_UserInfos_OperatorID",
                        column: x => x.OperatorID,
                        principalTable: "UserInfos",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_CaigouEnter_UserInfos_OpmanlID",
                        column: x => x.OpmanlID,
                        principalTable: "UserInfos",
                        principalColumn: "Id");
                });

            migrationBuilder.CreateTable(
                name: "CaigouOrder",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SupplierID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OrderDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DelicerDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Monetary = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    POD = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Others = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OperatorID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ExaminerID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ExamineState = table.Column<int>(type: "int", nullable: false),
                    Deal = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CaigouOrder", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CaigouOrder_Supplier_SupplierID",
                        column: x => x.SupplierID,
                        principalTable: "Supplier",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_CaigouOrder_UserInfos_ExaminerID",
                        column: x => x.ExaminerID,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_CaigouOrder_UserInfos_OperatorID",
                        column: x => x.OperatorID,
                        principalTable: "UserInfos",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_CaigouOrder_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "CaigouPaid",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PayTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Money = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    BiIIID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SupplierID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Monetary = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PayStyle = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PayFrom = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OperatorID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ExaminerIID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Others = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ExamineState = table.Column<int>(type: "int", nullable: false),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CaigouPaid", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CaigouPaid_Supplier_SupplierID",
                        column: x => x.SupplierID,
                        principalTable: "Supplier",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_CaigouPaid_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "CaigouPlan",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Depart = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PlanDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    PlannerID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Others = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OperatorID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    InDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ExaminerID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ExamineState = table.Column<int>(type: "int", nullable: false),
                    Deal = table.Column<int>(type: "int", nullable: false),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CaigouPlan", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CaigouPlan_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "CaigouReturned",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SupplierID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Monetary = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BillID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ReturnedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ShipperID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OperatorID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EnterDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    OpmanID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OpDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ExaminerID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ExamineDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Others = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ExamineState = table.Column<int>(type: "int", nullable: false),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CaigouReturned", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CaigouReturned_Supplier_SupplierID",
                        column: x => x.SupplierID,
                        principalTable: "Supplier",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_CaigouReturned_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "GoodsReturnedNote",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TheReturnDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Client = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Currency = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SalesPerson = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Acceptor = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Operator = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Auditor = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AuditStatus = table.Column<int>(type: "int", nullable: false),
                    DateOfEntry = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DateOfApproval = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TheCustomerTableId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsReturnedNote", x => x.Id);
                    table.ForeignKey(
                        name: "FK_GoodsReturnedNote_TheCustomerTable_TheCustomerTableId",
                        column: x => x.TheCustomerTableId,
                        principalTable: "TheCustomerTable",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_GoodsReturnedNote_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "Order",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OrderDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Client = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Currency = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SalesPerson = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SalesDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    PaymentMethod = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeliveryPoints = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CompletionStatus = table.Column<int>(type: "int", nullable: false),
                    Operator = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Auditor = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AuditStatus = table.Column<int>(type: "int", nullable: false),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TheCustomerTableId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Order", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Order_TheCustomerTable_TheCustomerTableId",
                        column: x => x.TheCustomerTableId,
                        principalTable: "TheCustomerTable",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_Order_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "Quotation",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    QuotationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Client = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Offerer = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Currency = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Operator = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TheCustomerTableId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Quotation", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Quotation_TheCustomerTable_TheCustomerTableId",
                        column: x => x.TheCustomerTableId,
                        principalTable: "TheCustomerTable",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_Quotation_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "Receipt",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CollectionDays = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Money = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Client = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Currency = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PersonHandlingATransaction = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PaymentTerm = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PaymentTo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Operator = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Auditor = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AuditStatus = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TheCustomerTableId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Receipt", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Receipt_TheCustomerTable_TheCustomerTableId",
                        column: x => x.TheCustomerTableId,
                        principalTable: "TheCustomerTable",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_Receipt_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "ShouldBeOfVoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TermOfLoan = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DateOfOccurrence = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Client = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Currency = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AmountReceivable = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    AmountReceived = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Balance = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    MarketOrSalesReturn = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Operator = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Auditor = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AuditStatus = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TheCustomerTableId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShouldBeOfVoucher", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ShouldBeOfVoucher_TheCustomerTable_TheCustomerTableId",
                        column: x => x.TheCustomerTableId,
                        principalTable: "TheCustomerTable",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_ShouldBeOfVoucher_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "UserRoleInfos",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    RoleInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Creator = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserRoleInfos", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserRoleInfos_RoleInfos_RoleInfosId",
                        column: x => x.RoleInfosId,
                        principalTable: "RoleInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_UserRoleInfos_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Alarminfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CommodityInformationSheetId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Unit = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Stock = table.Column<int>(type: "int", nullable: false),
                    Check = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CommodityInformationSheetId1 = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Alarminfo", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Alarminfo_CommodityInformationSheet_CommodityInformationSheetId1",
                        column: x => x.CommodityInformationSheetId1,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "Inrd",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ProductId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Num = table.Column<int>(type: "int", nullable: false),
                    Totalv = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    CommodityInformationSheetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Inrd", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Inrd_CommodityInformationSheet_CommodityInformationSheetId",
                        column: x => x.CommodityInformationSheetId,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "Inregister",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    InboundDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ProductId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ProductName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Avalue = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Ucode = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    UName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Opcode = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Operator = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CommodityInformationSheetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Inregister", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Inregister_CommodityInformationSheet_CommodityInformationSheetId",
                        column: x => x.CommodityInformationSheetId,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_Inregister_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "CaigouStorageDetails",
                columns: table => new
                {
                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    EnterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CommodityInformationSheetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Quantity = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UintPrice = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Others = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CaigouEnterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CaigouStorageDetails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CaigouStorageDetails_CaigouEnter_CaigouEnterId",
                        column: x => x.CaigouEnterId,
                        principalTable: "CaigouEnter",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_CaigouStorageDetails_CommodityInformationSheet_CommodityInformationSheetId",
                        column: x => x.CommodityInformationSheetId,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "CaiGouOrderDetails",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CaigouOrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CommodityInformationSheetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    UintPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Others = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CaiGouOrderDetails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CaiGouOrderDetails_CaigouOrder_CaigouOrderId",
                        column: x => x.CaigouOrderId,
                        principalTable: "CaigouOrder",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_CaiGouOrderDetails_CommodityInformationSheet_CommodityInformationSheetId",
                        column: x => x.CommodityInformationSheetId,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "PlanDetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CaigouPlanId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CommodityInformationSheetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    Others = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PlanDetail", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PlanDetail_CaigouPlan_CaigouPlanId",
                        column: x => x.CaigouPlanId,
                        principalTable: "CaigouPlan",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_PlanDetail_CommodityInformationSheet_CommodityInformationSheetId",
                        column: x => x.CommodityInformationSheetId,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "ReturnedDetail",
                columns: table => new
                {
                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ReturnedID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    GoodsID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    UintPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Others = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CaigouReturnedId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CommodityInformationSheetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReturnedDetail", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReturnedDetail_CaigouReturned_CaigouReturnedId",
                        column: x => x.CaigouReturnedId,
                        principalTable: "CaigouReturned",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_ReturnedDetail_CommodityInformationSheet_CommodityInformationSheetId",
                        column: x => x.CommodityInformationSheetId,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "ReturnList",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Commodity = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    ReturnSingleNumber = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    CommodityInformationSheetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    GoodsReturnedNoteId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReturnList", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReturnList_CommodityInformationSheet_CommodityInformationSheetId",
                        column: x => x.CommodityInformationSheetId,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_ReturnList_GoodsReturnedNote_GoodsReturnedNoteId",
                        column: x => x.GoodsReturnedNoteId,
                        principalTable: "GoodsReturnedNote",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "OrderDetails",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Commodity = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    OrderNo = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    CommodityInformationSheetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrderDetails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_OrderDetails_CommodityInformationSheet_CommodityInformationSheetId",
                        column: x => x.CommodityInformationSheetId,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_OrderDetails_Order_OrderId",
                        column: x => x.OrderId,
                        principalTable: "Order",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "OutboundDeliveryOrder",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SalesDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Client = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Currency = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PaymentMethod = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SalesPerson = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Consigner = table.Column<int>(type: "int", nullable: false),
                    DeliveryAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Operator = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Auditor = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AuditStatus = table.Column<int>(type: "int", nullable: false),
                    OrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DateOfEntry = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DateOfApproval = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UserInfosId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TheCustomerTableId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OutboundDeliveryOrder", x => x.Id);
                    table.ForeignKey(
                        name: "FK_OutboundDeliveryOrder_Order_OrderId",
                        column: x => x.OrderId,
                        principalTable: "Order",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_OutboundDeliveryOrder_TheCustomerTable_TheCustomerTableId",
                        column: x => x.TheCustomerTableId,
                        principalTable: "TheCustomerTable",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_OutboundDeliveryOrder_UserInfos_UserInfosId",
                        column: x => x.UserInfosId,
                        principalTable: "UserInfos",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "PaidDetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PaidID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OrderID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CurPay = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    CaigouEnterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PaidDetail", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PaidDetail_CaigouEnter_CaigouEnterId",
                        column: x => x.CaigouEnterId,
                        principalTable: "CaigouEnter",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_PaidDetail_Order_OrderID",
                        column: x => x.OrderID,
                        principalTable: "Order",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "QuotationSheetDetails",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Commodity = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    QuotationNo = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    CommodityInformationSheetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    QuotationId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QuotationSheetDetails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_QuotationSheetDetails_CommodityInformationSheet_CommodityInformationSheetId",
                        column: x => x.CommodityInformationSheetId,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_QuotationSheetDetails_Quotation_QuotationId",
                        column: x => x.QuotationId,
                        principalTable: "Quotation",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "DetailsOfTheReceipt",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TheOriginalNumber = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ThisCollection = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    ReceiptId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DetailsOfTheReceipt", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DetailsOfTheReceipt_Receipt_ReceiptId",
                        column: x => x.ReceiptId,
                        principalTable: "Receipt",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "DeliveryOrderDetails",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Commodity = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    OutgoingSingleNumber = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    CommodityInformationSheetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OutboundDeliveryOrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DeliveryOrderDetails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DeliveryOrderDetails_CommodityInformationSheet_CommodityInformationSheetId",
                        column: x => x.CommodityInformationSheetId,
                        principalTable: "CommodityInformationSheet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_DeliveryOrderDetails_OutboundDeliveryOrder_OutboundDeliveryOrderId",
                        column: x => x.OutboundDeliveryOrderId,
                        principalTable: "OutboundDeliveryOrder",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.InsertData(
                table: "Cinfo",
                columns: new[] { "Id", "InventoryValue", "MoneyKind", "WarehouseName" },
                values: new object[,]
                {
                    { new Guid("6109ed3f-d07a-4304-a9f1-80d81c712414"), 10000, "人民币", "饮料仓库" },
                    { new Guid("4f0b740f-5cc6-4876-a88b-ee90e6ec1bc7"), 10000, "人民币", "水果仓库" },
                    { new Guid("c177aec6-6e22-4667-9378-5da8f4ffcb17"), 10000, "人民币", "调料仓库" },
                    { new Guid("e93d5513-956d-4d82-8dfc-6a33fda78b02"), 10000, "人民币", "书籍仓库" }
                });

            migrationBuilder.InsertData(
                table: "GoodsType",
                columns: new[] { "Id", "TypeName" },
                values: new object[,]
                {
                    { new Guid("4bdbaa52-07c2-4f61-9291-a89a8a0bfff8"), "饮料" },
                    { new Guid("ff80d4a3-232c-43ce-934c-da5071efc4ed"), "水果" },
                    { new Guid("60c3abc2-2ae7-472c-94d6-f77ff9315cdd"), "调料" },
                    { new Guid("8adb1175-93e3-46e6-ab0c-9eb7cec2bd59"), "书籍" }
                });

            migrationBuilder.InsertData(
                table: "Supplier",
                columns: new[] { "Id", "Address", "BankAccount", "City", "Contactman", "Coutry", "DepositBank", "Email", "Position", "Postcode", "Remarks", "SupplierName", "TaxNum", "Tel", "UseState", "Website" },
                values: new object[,]
                {
                    { new Guid("aff55173-d0bc-4eeb-bb5f-d3895ca87b55"), "河南省安阳市金城大道", "62122 62502 00918 2455", "河南省安阳市", "辛俊华", "中国", "建设银行", "XinJunHua@163.com", "经理", "419007", "空", "罗俊供应商", "4029 1931 9398 4717", "17371813074", 1, "www.WeiKe" },
                    { new Guid("d9d13745-69ac-4325-b001-95eee6621994"), "河南省安阳市金城大道", "62122 62502 00918 2455", "河南省安阳市", "辛俊华", "中国", "建设银行", "XinJunHua@163.com", "经理", "419007", "空", "俊正供应商", "4029 1931 9398 4717", "17371813074", 1, "www.WeiKe" },
                    { new Guid("cc697194-e26d-40dd-bee7-e23c71b91a3d"), "河南省安阳市金城大道", "62122 62502 00918 2455", "河南省安阳市", "辛俊华", "中国", "建设银行", "XinJunHua@163.com", "经理", "419007", "空", "俊华供应商", "4029 1931 9398 4717", "17371813074", 1, "www.WeiKe" },
                    { new Guid("5b973f56-0372-46a3-8de5-7ba0e4c62d10"), "河南省安阳市金城大道", "62122 62502 00918 2455", "河南省安阳市", "辛俊华", "中国", "建设银行", "XinJunHua@163.com", "经理", "419007", "空", "俊乾供应商", "4029 1931 9398 4717", "17371813074", 1, "www.WeiKe" }
                });

            migrationBuilder.InsertData(
                table: "UserInfos",
                columns: new[] { "Id", "CreateTime", "Creator", "IsDeleted", "UserName", "UserPwd", "UserState" },
                values: new object[,]
                {
                    { new Guid("b710d3f7-f351-40d3-bcd1-75107ad9103a"), new DateTime(2021, 12, 8, 9, 35, 23, 774, DateTimeKind.Local).AddTicks(4046), "1", 1, "张智毅销售员", "123456", 1 },
                    { new Guid("36b59849-f90c-4e3c-8267-82d748ee172e"), new DateTime(2021, 12, 8, 9, 35, 23, 773, DateTimeKind.Local).AddTicks(3367), "1", 1, "admin", "123456", 1 },
                    { new Guid("262ef3b6-e387-4af7-a7a3-547c7df7d644"), new DateTime(2021, 12, 8, 9, 35, 23, 774, DateTimeKind.Local).AddTicks(4008), "1", 1, "小小", "123456", 1 },
                    { new Guid("c213d387-fb8f-4346-a0ae-216baf367012"), new DateTime(2021, 12, 8, 9, 35, 23, 774, DateTimeKind.Local).AddTicks(4041), "1", 1, "大大", "123456", 1 },
                    { new Guid("55ce58ee-6b1a-4590-b5df-f90eefa2377d"), new DateTime(2021, 12, 8, 9, 35, 23, 774, DateTimeKind.Local).AddTicks(4048), "1", 1, "采购员", "123456", 1 }
                });

            migrationBuilder.CreateIndex(
                name: "IX_Alarm_UserInfosId",
                table: "Alarm",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_Alarminfo_CommodityInformationSheetId1",
                table: "Alarminfo",
                column: "CommodityInformationSheetId1");

            migrationBuilder.CreateIndex(
                name: "IX_AuditLogging_UserInfosId",
                table: "AuditLogging",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouDuepay_SupplierId",
                table: "CaigouDuepay",
                column: "SupplierId");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouDuepay_UserInfosId",
                table: "CaigouDuepay",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouEnter_BuyerID",
                table: "CaigouEnter",
                column: "BuyerID");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouEnter_ExaminerID",
                table: "CaigouEnter",
                column: "ExaminerID");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouEnter_OperatorID",
                table: "CaigouEnter",
                column: "OperatorID");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouEnter_OpmanlID",
                table: "CaigouEnter",
                column: "OpmanlID");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouEnter_SupplierId",
                table: "CaigouEnter",
                column: "SupplierId");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouOrder_ExaminerID",
                table: "CaigouOrder",
                column: "ExaminerID");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouOrder_OperatorID",
                table: "CaigouOrder",
                column: "OperatorID");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouOrder_SupplierID",
                table: "CaigouOrder",
                column: "SupplierID");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouOrder_UserInfosId",
                table: "CaigouOrder",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_CaiGouOrderDetails_CaigouOrderId",
                table: "CaiGouOrderDetails",
                column: "CaigouOrderId");

            migrationBuilder.CreateIndex(
                name: "IX_CaiGouOrderDetails_CommodityInformationSheetId",
                table: "CaiGouOrderDetails",
                column: "CommodityInformationSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouPaid_SupplierID",
                table: "CaigouPaid",
                column: "SupplierID");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouPaid_UserInfosId",
                table: "CaigouPaid",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouPlan_UserInfosId",
                table: "CaigouPlan",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouReturned_SupplierID",
                table: "CaigouReturned",
                column: "SupplierID");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouReturned_UserInfosId",
                table: "CaigouReturned",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouStorageDetails_CaigouEnterId",
                table: "CaigouStorageDetails",
                column: "CaigouEnterId");

            migrationBuilder.CreateIndex(
                name: "IX_CaigouStorageDetails_CommodityInformationSheetId",
                table: "CaigouStorageDetails",
                column: "CommodityInformationSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_CommodityInformationSheet_CinfoId",
                table: "CommodityInformationSheet",
                column: "CinfoId");

            migrationBuilder.CreateIndex(
                name: "IX_DeliveryOrderDetails_CommodityInformationSheetId",
                table: "DeliveryOrderDetails",
                column: "CommodityInformationSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_DeliveryOrderDetails_OutboundDeliveryOrderId",
                table: "DeliveryOrderDetails",
                column: "OutboundDeliveryOrderId");

            migrationBuilder.CreateIndex(
                name: "IX_DetailsOfTheReceipt_ReceiptId",
                table: "DetailsOfTheReceipt",
                column: "ReceiptId");

            migrationBuilder.CreateIndex(
                name: "IX_GoodsReturnedNote_TheCustomerTableId",
                table: "GoodsReturnedNote",
                column: "TheCustomerTableId");

            migrationBuilder.CreateIndex(
                name: "IX_GoodsReturnedNote_UserInfosId",
                table: "GoodsReturnedNote",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_Inrd_CommodityInformationSheetId",
                table: "Inrd",
                column: "CommodityInformationSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_Inregister_CommodityInformationSheetId",
                table: "Inregister",
                column: "CommodityInformationSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_Inregister_UserInfosId",
                table: "Inregister",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_NventoryFile_CinfoId",
                table: "NventoryFile",
                column: "CinfoId");

            migrationBuilder.CreateIndex(
                name: "IX_Order_TheCustomerTableId",
                table: "Order",
                column: "TheCustomerTableId");

            migrationBuilder.CreateIndex(
                name: "IX_Order_UserInfosId",
                table: "Order",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_OrderDetails_CommodityInformationSheetId",
                table: "OrderDetails",
                column: "CommodityInformationSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_OrderDetails_OrderId",
                table: "OrderDetails",
                column: "OrderId");

            migrationBuilder.CreateIndex(
                name: "IX_OutboundDeliveryOrder_OrderId",
                table: "OutboundDeliveryOrder",
                column: "OrderId");

            migrationBuilder.CreateIndex(
                name: "IX_OutboundDeliveryOrder_TheCustomerTableId",
                table: "OutboundDeliveryOrder",
                column: "TheCustomerTableId");

            migrationBuilder.CreateIndex(
                name: "IX_OutboundDeliveryOrder_UserInfosId",
                table: "OutboundDeliveryOrder",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_PaidDetail_CaigouEnterId",
                table: "PaidDetail",
                column: "CaigouEnterId");

            migrationBuilder.CreateIndex(
                name: "IX_PaidDetail_OrderID",
                table: "PaidDetail",
                column: "OrderID");

            migrationBuilder.CreateIndex(
                name: "IX_PlanDetail_CaigouPlanId",
                table: "PlanDetail",
                column: "CaigouPlanId");

            migrationBuilder.CreateIndex(
                name: "IX_PlanDetail_CommodityInformationSheetId",
                table: "PlanDetail",
                column: "CommodityInformationSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_Quotation_TheCustomerTableId",
                table: "Quotation",
                column: "TheCustomerTableId");

            migrationBuilder.CreateIndex(
                name: "IX_Quotation_UserInfosId",
                table: "Quotation",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_QuotationSheetDetails_CommodityInformationSheetId",
                table: "QuotationSheetDetails",
                column: "CommodityInformationSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_QuotationSheetDetails_QuotationId",
                table: "QuotationSheetDetails",
                column: "QuotationId");

            migrationBuilder.CreateIndex(
                name: "IX_Receipt_TheCustomerTableId",
                table: "Receipt",
                column: "TheCustomerTableId");

            migrationBuilder.CreateIndex(
                name: "IX_Receipt_UserInfosId",
                table: "Receipt",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_ReturnedDetail_CaigouReturnedId",
                table: "ReturnedDetail",
                column: "CaigouReturnedId");

            migrationBuilder.CreateIndex(
                name: "IX_ReturnedDetail_CommodityInformationSheetId",
                table: "ReturnedDetail",
                column: "CommodityInformationSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_ReturnList_CommodityInformationSheetId",
                table: "ReturnList",
                column: "CommodityInformationSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_ReturnList_GoodsReturnedNoteId",
                table: "ReturnList",
                column: "GoodsReturnedNoteId");

            migrationBuilder.CreateIndex(
                name: "IX_RoleMenuInfos_MenuInfosId",
                table: "RoleMenuInfos",
                column: "MenuInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_RoleMenuInfos_RoleInfosId",
                table: "RoleMenuInfos",
                column: "RoleInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_ShouldBeOfVoucher_TheCustomerTableId",
                table: "ShouldBeOfVoucher",
                column: "TheCustomerTableId");

            migrationBuilder.CreateIndex(
                name: "IX_ShouldBeOfVoucher_UserInfosId",
                table: "ShouldBeOfVoucher",
                column: "UserInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_UserRoleInfos_RoleInfosId",
                table: "UserRoleInfos",
                column: "RoleInfosId");

            migrationBuilder.CreateIndex(
                name: "IX_UserRoleInfos_UserInfosId",
                table: "UserRoleInfos",
                column: "UserInfosId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Alarm");

            migrationBuilder.DropTable(
                name: "Alarminfo");

            migrationBuilder.DropTable(
                name: "AuditLogging");

            migrationBuilder.DropTable(
                name: "CaigouDuepay");

            migrationBuilder.DropTable(
                name: "CaiGouOrderDetails");

            migrationBuilder.DropTable(
                name: "CaigouPaid");

            migrationBuilder.DropTable(
                name: "CaigouStorageDetails");

            migrationBuilder.DropTable(
                name: "DeliveryOrderDetails");

            migrationBuilder.DropTable(
                name: "DetailsOfTheReceipt");

            migrationBuilder.DropTable(
                name: "Employee");

            migrationBuilder.DropTable(
                name: "GoodsType");

            migrationBuilder.DropTable(
                name: "Inrd");

            migrationBuilder.DropTable(
                name: "Inregister");

            migrationBuilder.DropTable(
                name: "NventoryFile");

            migrationBuilder.DropTable(
                name: "OrderDetails");

            migrationBuilder.DropTable(
                name: "PaidDetail");

            migrationBuilder.DropTable(
                name: "PlanDetail");

            migrationBuilder.DropTable(
                name: "QuotationSheetDetails");

            migrationBuilder.DropTable(
                name: "ReturnedDetail");

            migrationBuilder.DropTable(
                name: "ReturnList");

            migrationBuilder.DropTable(
                name: "RoleMenuInfos");

            migrationBuilder.DropTable(
                name: "ShouldBeOfVoucher");

            migrationBuilder.DropTable(
                name: "UserRoleInfos");

            migrationBuilder.DropTable(
                name: "CaigouOrder");

            migrationBuilder.DropTable(
                name: "OutboundDeliveryOrder");

            migrationBuilder.DropTable(
                name: "Receipt");

            migrationBuilder.DropTable(
                name: "CaigouEnter");

            migrationBuilder.DropTable(
                name: "CaigouPlan");

            migrationBuilder.DropTable(
                name: "Quotation");

            migrationBuilder.DropTable(
                name: "CaigouReturned");

            migrationBuilder.DropTable(
                name: "CommodityInformationSheet");

            migrationBuilder.DropTable(
                name: "GoodsReturnedNote");

            migrationBuilder.DropTable(
                name: "MenuInfos");

            migrationBuilder.DropTable(
                name: "RoleInfos");

            migrationBuilder.DropTable(
                name: "Order");

            migrationBuilder.DropTable(
                name: "Supplier");

            migrationBuilder.DropTable(
                name: "Cinfo");

            migrationBuilder.DropTable(
                name: "TheCustomerTable");

            migrationBuilder.DropTable(
                name: "UserInfos");
        }
    }
}
